#include <stdio.h>
#include "smart_net_pubsub.hpp"

int main(int argc, char* argv[])
{
    /* 输入参数检查 */
    if (argc != 3) {
        printf("FMT: > ./main_run <IP> <PORT>\n");
        printf("DMO: > ./tst_netpub_run 127.0.0.1 9000\n");
        return -1;
    }

    /* 参数配置 */
    char URL[32] = {0};
    sprintf(URL, "tcp://%s:%s", argv[1], argv[2]);

    /* 启动功能 */
    SmartNetPubsub sub(SmartNetPubsub::NP_SUB, URL);
    sub.init();
    printf("url:%s start ...\n", URL);
    sub.loop_recv_mesg([](uint8_t *buf, uint32_t len){
        printf("recv data, len: %d\n", len);
    });


    return 0;
}